#!/usr/bin/env bash
cd /var/local
git clone http://124.223.11.108:13000/demo2099/web.git
mkdir -p /var/local/nginx/{conf,html,logs}
touch /var/local/nginx/html/index.html
echo   "<html><body><h1> xxxxxxxxxxxxxe</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Wed Sep 09 15:07:28 CST 2020</div><div>There was an unexpected error (type=Not Found, status=404).</div><div>No message available</div></body></html>" >> /var/local/nginx/html/index.html
touch /var/local/nginx/conf/nginx.conf
cat >/var/local/nginx/conf/nginx.conf  <<EOF
user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;

    include /etc/nginx/conf.d/*.conf;


    server {
        listen       80;
        server_name  localhost;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }


    }
}
EOF
 docker run  -d --name mynginx  -p 80:80  -v /var/local/nginx/conf/nginx.conf:/etc/nginx/nginx.conf  -v /var/local/nginx/logs:/var/log/nginx  -v /var/local/web/love1:/usr/share/nginx/html nginx
